﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Text;
using WeChatIdentity.Constants;
using WeChatIdentity.Models;

namespace WeChatIdentity.EntityConfigurations
{
    public class UserRoleEntityTypeConfiguration
        : IEntityTypeConfiguration<UserRole>
    {
        public void Configure(EntityTypeBuilder<UserRole> builder)
        {

            builder.ToTable("UserRole", SchemaConstants.SchemaName);

            builder.HasKey(ci => new { ci.UserId,ci.RoleId});


            builder.Property(ci => ci.UserId)
            .IsRequired();

            builder.Property(ci => ci.RoleId)
            .IsRequired();


        }
    }
}
